#! /bin/sh

d=20110515
t=0
while [ $t -ne 8 ]
do
./../Preprocess/Preprocess -f ../../../netCDF2KVSML/${d}/rm_rokka24_${d}__u_000$t.kvsml -outname ${d}_u_000$t.kvsml
./../Preprocess/Preprocess -f ../../../netCDF2KVSML/${d}/rm_rokka24_${d}__v_000$t.kvsml -outname ${d}_v_000$t.kvsml
./../Preprocess/Preprocess -f ../../../netCDF2KVSML/${d}/rm_rokka24_${d}__w_000$t.kvsml -outname ${d}_w_000$t.kvsml
./../Data/uvw/uvw ${d}_u_000$t.kvsml ${d}_v_000$t.kvsml ${d}_w_000$t.kvsml ${d}_velocity_000$t.kvsml
rm ${d}_u_000$t.kvsml
rm ${d}_u_000${t}_value.dat
rm ${d}_v_000$t.kvsml
rm ${d}_v_000${t}_value.dat
rm ${d}_w_000$t.kvsml
rm ${d}_w_000${t}_value.dat
mv ${d}_velocity_000$t.kvsml ../../../Data/Ocean/${d}velo/
mv ${d}_velocity_000${t}_value.dat ../../../Data/Ocean/${d}velo/
t=`expr $t + 1`
done

d=20110516
t=0
while [ $t -ne 8 ]
do
./../Preprocess/Preprocess -f ../../../netCDF2KVSML/${d}/rm_rokka19_${d}__u_000$t.kvsml -outname ${d}_u_000$t.kvsml
./../Preprocess/Preprocess -f ../../../netCDF2KVSML/${d}/rm_rokka19_${d}__v_000$t.kvsml -outname ${d}_v_000$t.kvsml
./../Preprocess/Preprocess -f ../../../netCDF2KVSML/${d}/rm_rokka19_${d}__w_000$t.kvsml -outname ${d}_w_000$t.kvsml
./../Data/uvw/uvw ${d}_u_000$t.kvsml ${d}_v_000$t.kvsml ${d}_w_000$t.kvsml ${d}_velocity_000$t.kvsml
rm ${d}_u_000$t.kvsml
rm ${d}_u_000${t}_value.dat
rm ${d}_v_000$t.kvsml
rm ${d}_v_000${t}_value.dat
rm ${d}_w_000$t.kvsml
rm ${d}_w_000${t}_value.dat
mv ${d}_velocity_000$t.kvsml ../../../Data/Ocean/${d}velo/
mv ${d}_velocity_000${t}_value.dat ../../../Data/Ocean/${d}velo/
t=`expr $t + 1`
done

d=20110515
s=0
b=2
while [ $b -ne 8 ]
do
d=20110515
while [ $d -ne 20110517 ]
do
t=0
while [ $t -ne 8 ]
do
./../Compression/Compression -f ../../../Data/Ocean/${d}velo/${d}_velocity_000$t.kvsml -Bspline -b $b -writezk -outname VelocityBlock_${b}_${d}_000$t.zk
t=`expr $t + 1`
s=`expr $s + 1`
done
d=`expr $d + 1`
done
b=`expr $b + 1`
done